<template>
    <transition name="loading">
        <div class="cover" v-show="show">
            <div>
                <img src="@/assets/05.gif" alt="">
                <span>{{msg}}</span>
            </div>
        </div>
    </transition>
</template>

<script>
export default {
    props: {
        msg: {
            type: String,
            default: "加载中",
        },
        show: {
            type: Boolean,
            default: false,
        },
    },
};
</script>

<style lang="scss" scoped>
.cover {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba($color: #000000, $alpha: 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    div {
        position: relative;
        border-radius: 10px;
        padding: 20px;
        text-align: center;
        span {
            display: block;
            color: #fff;
            position: absolute;
            font-size: 24px;
            top: 65%;
            left: 50%;
            transform: translate(-50%, -50%);
        }
    }
}
.loading-enter,
.loading-leave-to {
    opacity: 0;
}
.loading-enter-active,
.loading-leave-active {
    transition: all 0.5;
}
</style>